<template>
  <div id="centreRight1">
    <div class="bg-color-black">
      <div class="d-flex pt-2 pl-2">
        <span style="color:#5cd9e8">
          <icon name="chart-line"></icon>
        </span>
        <div class="d-flex">
          <span class="fs-xl text mx-2">{{$t('3NBcOlyOB-XpFKVpPz0gq')}}</span>
        </div>
      </div>
      <div class="d-flex jc-center body-box">
        <dv-scroll-board :config="config" style="width: 100%;height:4.85rem" />
      </div>
    </div>
  </div>
</template>

<script>
import { createNamespacedHelpers } from 'vuex'
const { mapState } = createNamespacedHelpers('screen')

export default {
  data () {
    return {
      header: [],
      data: [],
      config: {},
      defaultConfig: Object.freeze({
        header: [
          this.$t('sgO8XTrpDs0hVu2JOZPmp'),
          this.$t('yEjiPWYS-gCnrnwXje3Eb'),
          this.$t('wgRc7OlPa8xt5Gum1570-'),
          this.$t('dUE9V6jUHBdS6m9avfiqp'),
          this.$t('XCxVt6ql220gPsvtmIbRX'),
          this.$t('vXlmksflnOFYhHXDCaOG2')
        ],
        // data: [
        //   ['组件1', 'dev-1', "<span  class='colorGrass'>↑75%</span>"],
        //   ['组件2', 'dev-2', "<span  class='colorRed'>↓33%</span>"],
        //   ['组件3', 'dev-3', "<span  class='colorGrass'>↑100%</span>"],
        //   ['组件4', 'rea-1', "<span  class='colorGrass'>↑94%</span>"],
        //   ['组件5', 'rea-2', "<span  class='colorGrass'>↑95%</span>"],
        //   ['组件6', 'fix-2', "<span  class='colorGrass'>↑63%</span>"],
        //   ['组件7', 'fix-4', "<span  class='colorGrass'>↑84%</span>"],
        //   ['组件8', 'fix-7', "<span  class='colorRed'>↓46%</span>"],
        //   ['组件9', 'dev-2', "<span  class='colorRed'>↓13%</span>"],
        //   ['组件10', 'dev-9', "<span  class='colorGrass'>↑76%</span>"]
        // ],
        rowNum: 7, // 表格行数
        headerHeight: 35,
        headerBGC: '#0f1325', // 表头
        oddRowBGC: '#0f1325', // 奇数行
        evenRowBGC: '#171c33', // 偶数行
        index: false,
        columnWidth: [100, 90, 60, 100, 150, 150],
        align: ['center', 'center']
      })
    }
  },
  computed: {
    ...mapState(['screendata'])
  },
  components: {},
  mounted () {
    this.makeData()
    this.makeConfig()
  },
  methods: {
    makeData () {
      const header = ['elec', 'money', 'number', 'equipmentname', 'starttime', 'endtime']
      this.data = this.screendata.last10bill.map(item => {
        const res = []
        header.forEach(h => { res.push(item[h]) })
        return res
      })
    },
    makeConfig () {
      this.config = _.assign({}, this.defaultConfig, {
        data: this.data
      })
    }
  }
}
</script>

<style lang="scss">
#centreRight1 {
  padding: 0.2rem 0.3rem;
  height: 6rem;
  min-width: 3.75rem;
  border-radius: 0.0625rem;
  .bg-color-black {
    height: 5.6rem;
    border-radius: 0.125rem;
  }
  .text {
    color: #c3cbde;
  }
  .body-box {
    border-radius: 0.125rem;
    overflow: hidden;
  }
}
</style>
